#ifndef __SkeletalAnimation_H__
#define __SkeletalAnimation_H__

#include "d3dheaders.h"
#include "defines.h"
#include "Array.h"
#include <vector>

namespace KEngine
{

struct DecomposedTM
{
	D3DXVECTOR3 scale;
	D3DXQUATERNION rotation;
	D3DXVECTOR3 translation;

	DecomposedTM() : scale(1.0f, 1.0f, 1.0f), translation(0.0f, 0.0f, 0.0f)
	{
		D3DXQuaternionIdentity(&rotation);
	}
};

class SkeletalAnimation
{
public:
	struct Frame
	{
		TimeValue				t;
		Array<DecomposedTM>		dm;
		Array<D3DXMATRIX>		tm;
		Array<int>				boneId;
	};
	typedef std::vector<Frame*> SkinFrameList;

	SkeletalAnimation();
	virtual ~SkeletalAnimation();

	bool			load(LPCTSTR filename);

	void			addFrame(Frame* frame);
	Frame*			getFrame(int idx);
	int				getNumFrames();

protected:
	SkinFrameList	mFrameList;
};

}

#endif //